package com.syf.starter.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

@Data
@ConfigurationProperties(prefix = "server.http")
public class SyHttpServerConfiguration {
    /**
     * server name
     */
    private String serverName;

    /**
     * web context name
     * */
    private String webContext = "/";

    /**
     * 监听IP
     */
    private String host = "0.0.0.0";

    /**
     * 监听端口
     */
    private Integer port;

    /**
     * 是否启动Xss攻击的字符过滤器
     * 启动会导致一些字符转化的开销，请权衡
     */
    private Boolean enableXssFilter = Boolean.FALSE;

    /**
     * 抗DOS开关
     */
    private Boolean enablePreventDoS = Boolean.FALSE;

    /**
     * DOS攻击判定的阈值
     */
    private Integer DOS_ATTACK_THRESHOLD = 100;

    /**
     * DOS攻击判定的间隔周期窗口,1-秒；2-分钟
     */
    private String DOS_CALS_TIME_WINDOW_UNIT = "2";

    /**
     * IP白名单pattern清单
     */
    private List<String> whiteIpPatterns;

    /**
     * IP白名单pattern清单
     */
    private List<String> blackIpPatterns;

    /**
     * 本服务平局响应时间秒数
     */
    private Float avgResponseSeconds = 1.5F;
}
